#include "doublelist.h"
#include "font.h"
#include "showbmp.h"
#include "ts.h"
#include "spro.h"
#include "fun.h"


int readlist(struct doublelist *head)
{
	
	struct doublelist *p=head;
	FILE *myfile;
	char buf[1500];
	
	myfile=fopen("2.txt","r+");
	if(myfile==NULL)
	{
		perror("打开文件失败了!\n");
		return -1;
	}
	
	while(1)
	{
		bzero(buf,1500);
		fgets(buf,100,myfile);
		sscanf(buf,"%[^@\n]@%f@%d@%s",p->name,&(p->price),&(p->num),p->picpath);
		list_insert_tail(head,p->name,p->price,p->num,p->picpath);
		
		if(feof(myfile)==1)
			break;
	}
	fclose(myfile);
}
